import { ListenEventType, PanelType } from "../util/defineConfig";
import OnEventMode from "../util/OnEventMode";
import GameModel from "./gameModel";
import GameScene from "./gameScene";
import GameView from "./gameView";
import nakama from "./nakama";

export class GameCtrl extends OnEventMode{
    private gameView:GameView = null
    private gameModel:GameModel = null
    // private nakama:Nakama = null
    public isMute:boolean = false
    init(gameView:GameView,gameModel:GameModel){
        this.gameView = gameView
        this.gameModel = gameModel
        // this.nakama = nakama
        this.gameModel.init()
        this.gameView.loadPanel(PanelType.STARTPANEL)
        
    }

    restartGame(){
        cc.director.loadScene('game',()=>{
            this.emit(ListenEventType.INIT_AUDIO,this.isMute)
            GameScene.isMute = this.isMute
        })
        // this.nakama.findMatch()
    }

    recvNetData(data){
        console.log('recvNetData',data)
    }
}